package com.juku2024.juku.model

import androidx.annotation.DrawableRes
import com.juku2024.juku.R
import com.juku2024.juku.tools.AppUtils

class MeListModel(var name: String?, @DrawableRes var icon: Int = 0, var content: String? = null) : BaseModel() {

    companion object {
        fun getMeList(): ArrayList<MeListModel> {
            val list = ArrayList<MeListModel>()
            // 历史
            val history = MeListModel(AppUtils.getString(R.string.history), R.drawable.ic_me_history)
            list.add(history)
            // 收藏
            val favorite = MeListModel(AppUtils.getString(R.string.favorite), R.drawable.ic_me_favorite)
            list.add(favorite)
            // 下载
            val download = MeListModel(AppUtils.getString(R.string.download), R.drawable.ic_me_download)
            list.add(download)
            // 下载
            val feedback = MeListModel(AppUtils.getString(R.string.feedback), R.drawable.ic_me_feedback)
            list.add(feedback)
            // 分享
            val share = MeListModel(AppUtils.getString(R.string.share), R.drawable.ic_share)
            list.add(share)
            // 常见问题
            val unlock = MeListModel("常见问题", R.drawable.ic_me_unlock)
            list.add(unlock)
            // 设置
            val setting = MeListModel(AppUtils.getString(R.string.setting), R.drawable.ic_me_setting)
            list.add(setting)
            return list
        }

        fun getSettingList(isUpdate: Boolean): ArrayList<MeListModel> {
            val list = ArrayList<MeListModel>()
            val str = if (!isUpdate) {
                "最新：" + AppUtils.getVersionName()
            } else {
                "更新：" + AppUtils.getVersionName()
            }
            // 检测升级
            val upgrade = MeListModel(AppUtils.getString(R.string.upgrade), 0, str)
            list.add(upgrade)

            // clear
            val clear = MeListModel(AppUtils.getString(R.string.clear), 0, AppUtils.getCacheMemory())
            list.add(clear)


            return list
        }
    }
}